//
// Chat.scss
//

.chat-leftsidebar {
    @media (min-width: 992px) {
        min-width: 260px;
    }

    @media (min-width: 1200px) {
        min-width: 380px;
    }

    .chat-leftsidebar-nav {
        .nav {
            background-color: var(--#{$prefix}secondary-bg);
        }

        .tab-content {
            min-height: 488px;
        }
    }
}

.chat-noti-dropdown {
    &.active {
        &:before {
            content: "";
            position: absolute;
            width: 8px;
            height: 8px;
            background-color: $danger;
            border-radius: 50%;
            right: 0;
        }
    }

    .btn {
        padding: 6px;
        box-shadow: none;
        font-size: 20px;
    }
}

.chat-search-box {
    .form-control {
        border: 0;
    }
}

.chat-list {
    margin: 0;
    li {
        &.active {
            a {
                background-color: var(--#{$prefix}secondary-bg);
                border-color: transparent;
                box-shadow: $box-shadow;
            }
        }
        a {
            display: block;
            padding: 14px 16px;
            color: var(--#{$prefix}secondary-color);
            transition: all 0.4s;
            border-top: 1px solid var(--#{$prefix}border-color);
            border-radius: 4px;
            &:hover {
                background-color: var(--#{$prefix}secondary-bg);
                border-color: transparent;
                box-shadow: $box-shadow;
            }
        }
    }
}

.chat-head {
    font-size: 16px;
    padding: 2vmin 2%;
    height: 10%;

    .chat-row {
        height: 100%;
        flex-wrap: nowrap;
        justify-content: space-between;

        .chat-head-info {
            display: flex;
            // flex: 0 0 fit-content;
            flex-direction: column;
            height: 100%;
            gap: 5px;

            .chat-head-agent {
                flex: 0.5;
                display: flex;
                gap: 10px;
                width: fit-content;
                height: 50%;

                .chat-head-agent-icon {
                    height: 80%;
                    max-height: 25px;
                }

                .chat-head-agent-name {
                    font-size: 0.8em;
                }
            }

            .chat-head-user {
                flex: 0.5;
                display: flex;
                gap: 5px;
                width: fit-content;
                font-size: 0.7em !important;
            }
        }
    }
}

.chat-content {
    height: 82%;
}

.chat-content-expand {
    height: 98%;
}

.user-chat-nav-flex {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
}

.user-chat-nav {
    align-self: stretch;
    min-width: 30px;
    min-height: 30px;

    .nav-btn {
        color: var(--#{$prefix}body-color);
        box-shadow: none;
        padding: 0;
        background-color: var(--#{$prefix}light);
        border-radius: 50%;
        border: none;
        // width: 40px;
        // height: 40px;
        width: 2em;
        height: 2em;

        i {
            font-size: 0.8em;
        }
    }
    
    .dropdown {
        width: 100%;
        height: 100%;

        .state-menu > .dropdown-menu {
            inset: 0px auto auto 0px !important;
        }

        .dropdown-menu {
            box-shadow: $box-shadow;
            border: 1px solid var(--#{$prefix}border-color);
        }
    }

    .large-btn {
        width: 40px;
        height: 40px;
    }

    .btn-pair {
        display: flex;

        .btn-left {
            border-top-right-radius: 0px;
            border-bottom-right-radius: 0px;
        }

        .btn-right {
            border-top-left-radius: 0px;
            border-bottom-left-radius: 0px;
        }

        i, span {
            font-size: 0.9em;
        }
    }
}

.chat-conversation {
    li {
        clear: both;
    }

    .chat-day-title {
        position: relative;
        text-align: center;
        margin-bottom: 24px;

        .title {
            background-color: var(--#{$prefix}secondary-bg);
            position: relative;
            z-index: 1;
            padding: 6px 24px;
        }

        &:before {
            content: "";
            position: absolute;
            width: 100%;
            height: 1px;
            left: 0;
            right: 0;
            background-color: var(--#{$prefix}border-color);
            top: 10px;
        }
        .badge {
            font-size: 12px;
        }
    }

    .conv-msg-container {
        display: flex;
        position: relative;
        width: 100%;
        margin-bottom: 20px;

        .cicon-wrap {
            margin-right: 4px;
            flex: 0 0 fit-content;
        }

        .msg-container {
            display: flex;
            flex-direction: column;
            width: 80%;

            .bot-msg {
                background-color: var(--#{$prefix}light) !important;
            }
        }

        .ctext-wrap {
            padding: 8px 12px;
            background-color: rgba($primary, 0.1);
            border-radius: 8px 8px 8px 0px;
            overflow: hidden;
            width: fit-content;
            max-width: 100%;
            word-break: break-all;

            .conversation-name {
                font-weight: $font-weight-semibold;
                color: $primary;
                margin-bottom: 4px;
            }

            span p {
                margin-top: 0px;
                margin-bottom: 0px;
            }

            .chat-indication {
                font-size: 1em;
            }
        }

        .image-wrap {
            margin-top: 2px;
            width: fit-content;

            img {
                max-width: 25vw;
                max-height: 25vh;
            }
        }

        .dropdown {
            .dropdown-toggle {
                font-size: 18px;
                padding: 4px;
                cursor: pointer;
                color: var(--#{$prefix}secondary-color);
            }

            .dropdown-menu {
                box-shadow: $box-shadow;
                border: 1px solid var(--#{$prefix}border-color);
                top: 10px !important;
            }
        }

        .chat-time {
            font-size: 12px;
        }
    }

    .right {
        .conv-msg-container {
            justify-content: flex-end;

            .msg-container {
                display: flex;
                flex-direction: column;
                align-items: flex-end;
            }

            .ctext-wrap {
                background-color: var(--#{$prefix}light);
                text-align: right;
                border-radius: 8px 8px 0px 8px;
                width: inherit;
            }

            &.last-chat {
                .conv-msg-container {
                    &:before {
                        right: 0;
                        left: auto;
                    }
                }
            }
        }
    }

    .last-chat {
        .conv-msg-container {
            &:before {
                content: "\F0009";
                font-family: "Material Design Icons";
                position: absolute;
                color: $primary;
                right: 0;
                bottom: 0;
                font-size: 16px;

                @media (max-width: 575.98px) {
                    display: none;
                }
            }
        }
    }
}

.scroll-bottom-to-top {
    display: flex;
    flex-direction: column-reverse;
    overflow-y: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

.chat-input-section {
    padding: 0 2%;
    height: 8%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
}

.chat-input-hide {
    display: none;
    height: 2%;
}

.chat-input {
    border-radius: 5px;
    background-color: var(--#{$prefix}light) !important;
    border-color: var(--#{$prefix}light) !important;
    resize: none;
    padding-right: 1rem;
    scrollbar-width: none;
}

.chat-more-util {
    padding-right: 5em;
}

.chat-util-links {
    display: flex;
    width: fit-content;
    position: absolute;
    right: 3px;
    top: 55%;
    transform: translateY(-50%);

    li {
        span {
            font-size: 160% !important;
            line-height: 36px;
            padding: 0px 4px;
            display: inline-block;
            color: var(--bs-primary);
        }
    }
}

.chat-util-trigger {
    text-align: center;

    li {
        span {
            font-size: 200%;
            line-height: 36px;
            padding: 0px 4px;
            display: inline-block;
            color: var(--bs-primary);
        }
    }
}

.chat-log {
    height: 100vh;

    .log-flex {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .log-header {
        flex: 2%;
    }

    .log-body {
        flex: 96%
    }

    .log-footer {
        flex: 2%;

        .log-footer-nav-btn {
            font-size: 0.75em;
        }
    }

    .instant-log-body {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 0px 20px;
        overflow-y: scroll;
        scrollbar-width: none;

        .instant-log-section {
            border-radius: 10px;
            border: 1px solid var(--bs-secondary);
            display: flex;
            flex-direction: column;

            .latest-state-log {
                padding: 8px;
            }

            .close-icon {
                font-size: 20px;
                color: red;
                padding: 0 5px;
                
                i {
                    cursor: pointer;
                }
            }

            .chat-agent-info {
                overflow-y: scroll;
                scrollbar-width: none;
                flex: 0 0 fit-content;
                height: fit-content;
                max-height: $log-sec-height-md;

                .chat-agent-row {
                    margin: 8px 0px;
                    color: white;
                    font-size: 14px;
                    text-align: center;
                }
            }
        }

        .instant-log-sec-lg {
            flex: 0 0 $log-sec-height-lg;
            height: $log-sec-height-lg;
            min-height: $log-sec-height-lg;
        }

        .instant-log-sec-md {
            flex: 0 0 $log-sec-height-md;
            height: $log-sec-height-md;
            min-height: $log-sec-height-md;
        }

        .instant-log-sec-sm {
            flex: 0 0 $log-sec-height-sm;
            height: $log-sec-height-sm;
            min-height: $log-sec-height-sm;
        }
    }

    .nav-group {
        margin: 0px 3px;
    }

    .padding-side {
        padding-left: 20px;
        padding-right: 20px;

        ul {
            padding-left: 2px !important;
            padding-right: 0px !important;
        }
    }

    .log-background {
        background-color: black;

        .log-close-btn {
            margin-top: 1rem;
            margin-bottom: 0.5rem;
            position: sticky;
            display: flex;
            justify-content: space-between;
        }
    
        .log-list {
            background-color: black;

            .log-element {
                margin-top: 10px;
                margin-bottom: 15px;

                .log-meta {
                    font-size: 15px;
                    color: white;
                }
            
                .log-content {
                    font-size: 17px;
                    color: white;

                    li {
                        margin-top: 5px;
                        margin-bottom: 5px;
                    }
                }

                .log-collapse {
                    overflow-y: hidden;
                    height: fit-content;
                    max-height: 200px;
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 10;
                }
                
                .divider {
                    overflow: visible; /* For IE */
                    padding: 0;
                    border: none;
                    border-top: medium double white;
                    color: white;
                    text-align: center;
                }

                .toggle-btn {
                    outline: none;
                    box-shadow: none;
                    color: white;
                    font-size: 15px;
                    padding-left: 0px;
                }
            }

            .state-change-container {
                margin-top: 0px;
                margin-bottom: 5px;
                padding-left: 10px;

                .state-source {
                    font-size: 12px;
                }
                
                .state-value-container {
                    display: flex;
                    flex-wrap: wrap;

                    .state-value {
                        min-width: 50%;
                        font-size: 15px;

                        .active-rounds {
                            font-size: 12px;
                        }
                    }
                }
            }

            .queue-change-container {
                margin: 5px 0px;
                padding: 0px 10px;

                .log-content {
                    text-align: center;
                    font-size: 15px;
                    margin-top: 2px;
                    margin-bottom: 2px;
                }
            }

            .state-log-item {
                margin-top: 5px;
                margin-bottom: 10px;

                .log-content {
                    span {
                        font-size: 16px;
                    }
                }
            }
        }
    }
}


.chat-iframe {
    @media (max-width: 1024px) {
        position: fixed;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        margin:0 !important;
        padding:0 !important;
        overflow: hidden !important;
    }
}

.state-form {
    padding-left: 25px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 800px;
    scrollbar-width: thin;

    .state-input {
        flex: 0.45;
    }

    .state-key-input {
        flex: 0.3;
    }

    .state-value-input {
        flex: 0.4;
    }

    .state-num-input {
        flex: 0.2;
    }
    
    .state-delete {
        flex: 0.1;
        color: var(--bs-danger);
        font-size: 12px;
    }

    .invalid {
        border-color: var(--bs-danger);
    }
}

.msg-disclaimer {
    margin-top: 3px;
    padding: 5px 10px;
    border-radius: 5px;
    border-color: var(--bs-success-border-subtle);
    background-color: var(--bs-success-bg-subtle);
    font-size: 0.85em;
    font-weight: 500;
    color: var(--bs-secondary)
}

.center-option {
    justify-content: center;
    padding: 0px 10px;
}

.video-option-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;

    .video-element-card {
        border: none;
        box-shadow: none;
        flex: 1 1 300px;

        .card-body {
            padding: 0 !important;
        }

        .video-element-title {
            font-size: 1.1em;
            font-weight: 700;
            padding-left: 5px;
            padding-top: 10px;
            padding-bottom: 10px;
            margin-bottom: 5px;
            width: 100%;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .video-element-player {
            aspect-ratio: 16 / 9;

            video, iframe {
                border-radius: 10px;
                height: 100%;
            }
        }
    }
}

.plain-option-container {
    display: flex;
    flex-wrap: wrap;

    .btn:not([name="confirm"]) {
        &:hover {
            background-color: #fff;
            color: var(--bs-primary);
        }
    }

    .btn.active:hover {
        background-color: var(--bs-primary);
        color: #fff;
    }

    button {
        min-width: 50px;
        border-radius: 10px;
    }

    .link-option:hover {
        text-decoration: underline;
    }

    .chat-uploader {
        font-size: 18px;
    }
}

.complex-option-container {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 10px;

    .card-element {
        flex: 1 1 50%;
        border-radius: 10px;
        border-width: 2px;
        max-width: calc(50% - 2.5px);
        margin-bottom: 0px;

        @media (max-width: 620px) {
            width: 100%;
            max-width: 100%;
        }

        .card-element-body {
            display: flex;
            flex-direction: column;
            justify-content: space-evenly;
            gap: 5px;
            padding: 10px 15px;
            overflow-y: auto;
            scrollbar-width: none;
            height: fit-content;
            max-height: 200px;

            .card-element-title {
                font-size: 0.85rem;
                font-weight: 700;
            }

            .card-element-subtitle {
                font-size: 0.8rem;
                font-weight: 500;
            }

            .card-element-text {
                font-size: 0.75rem;
                font-weight: 400;
                padding: 5px;
            }

            .card-option-group {
                margin-top: 5px;

                .btn {
                    display: block;
                    margin-left: 0px !important;
                    border-radius: 10px;
                }

                .link-option:hover {
                    text-decoration: underline;
                }
            }
        }
    }
}

.conv-tags-container {
    display: flex;
    flex-wrap: wrap;
    overflow-y: auto;
    scrollbar-width: none;
    min-height: 80px;
    max-height: 180px;

    .conv-tag-unit {
        flex: 0 0 50%;
        
        label {
            font-size: 14px;
            font-weight: 400;
        }
    }
}